<template>
	<view class="contianer">
		<div class="index">

			<!-- <div class="indexTitle">商家列表</div> -->
			<div class="indexList">
				<u-empty mode="favor" v-if="show" icon="http://cdn.uviewui.com/uview/empty/favor.png"></u-empty>
				<div v-else class="indexListItem" v-for="(item, index) in list.member" :key="index" @click="detil(item.id)">
					<div class="indexListItemLeft">
						<img v-show="item.type==1" :src="'https://admin.lykangshu.top'+item.work_photos" alt="">
						<img v-show="item.type==2" :src="'https://admin.lykangshu.top'+item.store_photo" alt="">
					</div>
					<div class="indexListItemRight">
						<div class="indexListItemRightTxt1">
							<div v-show="item.type==1" class="indexListItemRightTxt1Name">{{item.name}}</div>
							<div v-show="item.type==2" class="indexListItemRightTxt1Name">{{item.store_name}}</div>
							<img src="@/static/img/star.png" alt="">
							<div class="indexListItemRightTxt1Star">{{item.score}}</div>
						</div>
						<div class="indexListItemRightTxt2">
							<img class="indexListItemRightTxt2Img" src="@/static/img/badge.png" alt="">
							<div class="indexListItemRightTxt1Star">资质认证</div>
							<img src="@/static/img/rightArrow.png" alt="">
							<div class="indexListItemRightTxt2Tips">最近接单 {{item.single_quantity}}单</div>
						</div>
						<div class="indexListItemRightTxt3">
							<div class="indexListItemRightTxt3Left">
								<img v-show="item.type==2" src="@/static/img/shop.png" alt="">
							</div>
							<div class="indexListItemRightTxt3Right">
								<img src="@/static/img/site.png" alt="">
								<div>{{item.distance}}km</div>
							</div>
						</div>
						<div class="indexListItemRightTxt4">
							<div class="indexListItemRightTxt4Left">
								<div class="indexListItemRightTxt4LeftItem" v-for="(item, index) in item.label" :key="index">{{item}}
								</div>
							</div>
							<div class="indexListItemRightTxt4Right">
								立即预约
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:{},
				show:null
			}
		},
		onLoad() {
			this.getmyshoucang()
		},
		methods: {
			async getmyshoucang(){
				const res = await this.$api("/api/user/collect",'post').then((res)=>{
					// console.log(res);
					console.log(res.data.data.member);
					if(res.data.code==1){
						this.list = res.data.data
						if(res.data.data.member.length==0){
							this.show = true
						}else{
							this.show = false
						}
					}
				})
			},
			detil(i){
				uni.navigateTo({
					url:'../../pages/index/detil/detil?id='+i
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	view {
		box-sizing: border-box;
		font-family: PingFang SC, PingFang SC;
	}

	.contianer {
		min-height: calc(100vh - 44px);
		background: #F5F5F5;
		// padding: 20px 15px;
	}

	.index {
		position: relative;
		font-family: PingFang SC-Bold;

		.indexBg {
			width: 100%;
			height: 280rpx;
			position: absolute;
			top: 0;
			left: 0;
			display: block;
		}

		.indexBanner {
			width: 690rpx;
			height: 284rpx;
			position: absolute;
			top: 84rpx;
			left: 50%;
			transform: translateX(-50%);
			display: block;
		}

		.indexTitle {
			// padding-top: 400rpx;
			padding-left: 30rpx;
			color: #FB774B;
			font-size: 32rpx;
			font-family: PingFang SC-Bold;
			font-weight: Bold;
			line-height: 44rpx;
		}

		.indexList {
			padding: 30rpx;
			box-sizing: border-box;

			.indexListItem {
				background-color: #fff;
				padding: 24rpx;
				box-sizing: border-box;
				display: flex;
				border: 2rpx solid rgba(0, 0, 0, 0.05);
				margin-bottom: 26rpx;
				border-radius: 20rpx;

				.indexListItemLeft {
					width: 190rpx;
					flex: 0 0 190rpx;
					height: 190rpx;

					img {
						width: 100%;
						height: 100%;
						display: block;
					}
				}

				.indexListItemRight {
					margin-left: 16rpx;
					width: 100%;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.indexListItemRightTxt1 {
						display: flex;
						align-items: center;

						img {
							margin-left: 26rpx;
						}

						.indexListItemRightTxt1Star {
							margin-left: 6rpx;
							color: #FDAE47;
							font-size: 24rpx;
						}

						.indexListItemRightTxt1Name {
							color: #333;
							font-size: 30rpx;
							font-weight: Bold;

						}
					}

					.indexListItemRightTxt2 {
						display: flex;
						align-items: center;

						.indexListItemRightTxt2Img {
							margin-left: -7rpx;
						}

						.indexListItemRightTxt2Tips {
							color: #999;
							font-weight: Bold;
							font-size: 24rpx;
							margin-left: 8rpx;
						}
					}

					.indexListItemRightTxt3 {
						display: flex;
						align-items: center;
						justify-content: space-between;

						.indexListItemRightTxt3Left {
							display: flex;
							align-items: center;

							img {
								margin-right: 6rpx;
							}

							div {
								color: #333;
								font-size: 24rpx;
							}
						}

						.indexListItemRightTxt3Right {
							display: flex;
							align-items: center;

							img {
								margin-right: 10rpx;
							}

							div {
								color: #999;
								font-size: 22rpx;
							}
						}
					}

					.indexListItemRightTxt4 {
						display: flex;
						align-items: center;
						justify-content: space-between;

						.indexListItemRightTxt4Left {
							display: flex;

							.indexListItemRightTxt4LeftItem {
								background: #FEE3C5;
								color: #FB774B;
								font-size: 18rpx;
								border-radius: 80rpx;
								padding: 4rpx 10rpx;
								margin-right: 4rpx;
							}
						}

						.indexListItemRightTxt4Right {
							background: #ff6d55;
							padding: 10rpx 18rpx;
							border-radius: 52rpx;
							color: #fff;
							font-weight: Bold;
							font-size: 22rpx;
						}
					}
				}
			}
		}
	}
</style>